package payrechargelogic

import (
	"context"
	modelWithdraw "gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/dao/model/withdraw"

	"gitee.com/liuxuezhan/ar-platform/assets-rpc/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/assets-rpc/rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type VirtualDicsListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewVirtualDicsListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VirtualDicsListLogic {
	return &VirtualDicsListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *VirtualDicsListLogic) VirtualDicsList(in *rpc.VirtualDicsListReq) (*rpc.VirtualDicsListResp, error) {

	list := modelWithdraw.NewVirtualDicModel(l.ctx, l.svcCtx).GetRateList()
	var resp []*rpc.VirtualDics

	for _, v := range list {
		resp = append(resp, &rpc.VirtualDics{
			Coin_Name: v.CoinName,
			To_Rata:   v.ToRate,
			Icon:      v.Icon,
		})
	}
	return &rpc.VirtualDicsListResp{
		List: resp,
	}, nil
}
